<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

	<ui:composition template="/faces/manager/xhtml/templates/template.xhtml">
		<ui:define name="manager-content">
			<table id="manager-content-panel" cellpadding="0" cellspacing="1">
				<tr>
					<td id="manager-content-header">
						<h:form>	
							<p:breadCrumb>
								<p:menuitem value="#{msg['manager.menu.navigator.home']}"/>
								<p:menuitem ajax="false" value="#{msg['manager.menu.navigator.admin']}" action="/faces/manager/xhtml/main.xhtml"  />
								<p:menuitem value="#{msg['manager.menu.navigator.mensagem']}" />
							</p:breadCrumb>								
						</h:form>
					</td>
				</tr>
				<tr>
					<td id="manager-content-body">
						<h:form prependId="false">	
							<p:growl id="showMessages" showDetail="true" />
							<p:fieldset legend="#{msg['manager.menu.left.admin.mensagem.title']}" styleClass="manager-fieldset-content">								
								<p:spacer height="10px"/>
								<p:outputPanel id="mensagem-panel">
									<p:dataTable 
										var="mensagem" 
										value="#{mensagemController.lazyModelMensagem}" 
										lazy="true" 
										rows="#{mensagemController.pageSize}" 
										paginator="true"
										paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
										rowsPerPageTemplate="#{mensagemController.pageSize}"
										emptyMessage="#{msg['messages.list.not.found']}">
										 
										<p:column headerText="#{msg['manager.mensagem.list.grid.column.nome']}" >
											<h:outputText value="#{mensagem.nome}" />
										</p:column>
										<p:column headerText="#{msg['manager.mensagem.list.grid.column.remetente']}" >
											<h:outputText value="#{mensagem.email}" />
										</p:column>
										<p:column headerText="#{msg['manager.mensagem.list.grid.column.data']}" >
											<h:outputText value="#{mensagem.dataEnvio}">
												<f:convertDateTime pattern="dd/MM/yyyy HH:mm" />												
											</h:outputText>
										</p:column>		
										
										<p:column  styleClass="view-column-image">
											<p:commandLink oncomplete="mensagemDialog.show();" update="display-mensagem">
												<h:graphicImage value="#{resource['images:icons/16x16/mail.png']}" />  
								                <f:setPropertyActionListener value="#{mensagem}" target="#{mensagemController.mensagem}"/>  
								            </p:commandLink>  
										</p:column>																			
									
									</p:dataTable>
									
									 <p:dialog header="#{msg['manager.mensagem.detalhado.title']}" widgetVar="mensagemDialog" resizable="false" 
							        	modal="true" styleClass="dialog" showEffect="clip" position="top" width="400">        	
							        	<p:outputPanel id="display-mensagem">
							        		<p:panel id="mensagem">
							        			<table cellpadding="0" cellspacing="0">
							        				<tr>
							        					<td class="view-column-label"><h:outputText value="#{msg['manager.mensagem.detalhado.nome']}:" /></td>
							        					<td class="view-column-value"><h:outputText value="#{mensagemController.mensagem.nome}"  /></td>
							        				</tr>
							        				<tr>
							        					<td class="view-column-label"><h:outputText value="#{msg['manager.mensagem.detalhado.remetente']}:" /></td>
							        					<td class="view-column-value"><h:outputText value="#{mensagemController.mensagem.email}"  /></td>
							        				</tr>
							        				<tr>
							        					<td class="view-column-label"><h:outputText value="#{msg['manager.mensagem.detalhado.data']}:" /></td>
							        					<td class="view-column-value">
							        						<h:outputText value="#{mensagemController.mensagem.dataEnvio}">
																<f:convertDateTime pattern="dd/MM/yyyy HH:mm" />												
															</h:outputText>
							        					</td>
							        				</tr>
							        				<tr>
							        					<td class="view-column-label"><h:outputText value="#{msg['manager.mensagem.detalhado.descricao']}:" /></td>
							        					<td class="view-column-value"><h:outputText value="#{mensagemController.mensagem.descricao}"  /></td>
							        				</tr>			        				
							        			</table>
							        		</p:panel>
							        	</p:outputPanel>        	
							        </p:dialog>
									
								</p:outputPanel>							 	
								<p:spacer height="10px"/>								
							</p:fieldset>
						</h:form>
					</td>
				</tr>
			</table>
		</ui:define>
	
	</ui:composition>
</html>